import Vue from 'vue';
import VueRouter from 'vue-router';

import { childrenRouter } from '@/router/constant-router';
const Pages = () => import('@/views/pages/index.vue');
const error = () => import('@/views/error/index.vue');

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: '/pages/testPage'
  },
  {
    path: '/pages',
    component: Pages,
    children: childrenRouter
  },
  {
    path: '/error',
    component: error
  },
  {
    path: '*',
    redirect: '/error'
  }
];

const router = new VueRouter({
  routes
});

export default router;
